// 封装二级页面的接口
import http from './request'
import qs from 'qs'


export const getBargainList = (params)=>http.get('/shop/goods/kanjia/list',{params})
// 获取详情接口
export const getGoodsDetail = (params)=>http.post('/shop/goods/detail?id='+params.id)

// formData格式 params是转换过后的formData格式数据
// export const getGoodsDetail = (params)=>http.post('/shop/goods/detail',params)


// export const getGoodsDetail = (params)=>http({
//     method: 'post', //请求方式
//     url: '/shop/goods/detail',//请求地址
//     params:params //参数    data和params是不固定，具体要看应用场景，一般get请求是params，post请求是data

// export const getSms = (params)=>http({
//     method:'post',
//     url:'/verification/sms/get',
//     params:params ///所有的参数都拼接在url后面
// })
export const getSms = (params)=>http({
    method:'post',
    url:'/verification/sms/get',
    data:qs.stringify(params) 
})
// qs.stringify()  json对象转换为json字符串
// qs.parse() json字符串转换为json对象
export const registerApi = (params)=>http({
    method:'post',
    url:'/user/m/register',
    data:qs.stringify(params) 
})
export const loginApi =(params)=>http({
    method:'post',
    url:'/user/m/login?deviceId=007&deviceName=monkey',
    params:params 

})
// 根据不同的规格返回不同的价格和库存的接口
export const getTicsApi =(params)=>http({
    method:'post',
    url:'/shop/goods/price',
    params:params 

})

export const getAddressDefault =(params)=>http({
    method:'post',
    url:'/user/shipping-address/default',
    params:params 

})
// 创建订单
export const createOrder = (params)=>http({
    method:'post',
    url:'/order/create',
    data:qs.stringify(params) 
})
export const getAddressList = (params)=>http({
    method:'post',
    url:'/user/shipping-address/list',
    data:qs.stringify(params) 
})

export const delAddress = (params)=>http({
    method:'post',
    url:'/user/shipping-address/delete',
    data:qs.stringify(params) 
})
// 添加地址


export const addAddressApi = (params)=>http({
    method:'post',
    url:'/user/shipping-address/add',
    data:qs.stringify(params) 
})
// https://api.it120.cc/small4/score/logs
export const getLogs = (params)=>http({
    method:'post',
    url:'/score/logs',
    data:qs.stringify(params) 
})
// 获取订单列表接口
export const getOrderList = (params)=>http({
    method:'post',
    url:'/order/list',
    data:qs.stringify(params) 
})
// 获取订单详情接口
export const getOrderDetail = (params)=>http({
    method:'post',
    url:'/order/detail',
    data:qs.stringify(params) 
})




